package com.lvchenglong.aopdemo;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class UserServiceAspect {

    /**
     * execution
     * within
     * this 和 target
     * args
     * @target
     * @annotation
     */
    @Pointcut("execution(public void UserService.small())")
    public void smallCut() {
        System.out.println("pointcut");
    }

    @AfterReturning("smallCut()")
    public void log(JoinPoint joinPoint) {
        System.out.println(joinPoint.getSignature() + " executed");
    }
}
